<?php


namespace frontend\models\cyf;


use yii\db\ActiveRecord;

class Order extends ActiveRecord
{
    public static function tableName()
    {
        return '2008a_order';
    }

    /**
     * 生成订单
     * @param $params
     * @cyf
     */
    public static function create($params)
    {
        $model = new Order();
        $model->order_no = $params['order_no'];
        $model->user_id = $params['user_id'];
        $model->status = $params['status'];
        $model->pay_status = $params['pay_status'];
        $model->real_amount = $params['real_amount'];
        return $model->save();
    }

    /**
     * 得到刚添加订单id
     * @return string
     * @cyf
     */
    public static function getInsertId()
    {
        return \Yii::$app->db->getLastInsertID();
    }
}